package com.yzd.netmonitor.util;

import java.util.Calendar;
import java.util.Date;

import org.apache.commons.lang3.time.DateFormatUtils;

public class PathUtils {

	private static final String DEFAULT_DATE_PATTERN = "yyyy/MM/dd";

	public static String getCurrentDatePath() {

		return DateFormatUtils.format(Calendar.getInstance(), DEFAULT_DATE_PATTERN);
	}

	public static String getDatePath(Date date) {

		return DateFormatUtils.format(date, DEFAULT_DATE_PATTERN);
	}

	public static String getDatePath(Date date, String pattern) {

		return DateFormatUtils.format(date, pattern);
	}
	
	public static String getCurrentDatePath(String rootPath) {
		return rootPath==null?"":rootPath+DateFormatUtils.format(Calendar.getInstance(), DEFAULT_DATE_PATTERN);
	}
	
	public static String getDatePath(String root,Date date, String pattern) {
		return root==null?"":root+DateFormatUtils.format(date, pattern);
	}

	public static void main(String[] args) {

		System.out.println(PathUtils.getCurrentDatePath("/root"));
	}
}
